package com.itxx.anonymousAndLambda.test5;
////接口抽象方法  没有参数  有  String类型 返回值
public interface EatAble {
   String eat();
}

class EatImpl implements EatAble {
    @Override
    public String eat() {
        return "(接口实现)肉夹馍";
    }
}

class Test1{
    public static void main(String[] args) {
        //接口实现类
        EatImpl e =new EatImpl();
        String food = e.eat();
        System.out.println("今天中午吃的"+food);
        //通过匿名内部类
       useEatAble(new EatAble() {
           @Override
           public String eat() {
               return "(匿名内部类)米饭";
           }
       });
        //lambda表达式实现
        useEatAble(()->{
            return "(lambda)饺子";
        });
    }

    public static void useEatAble(EatAble eatTest) {
        String food= eatTest.eat();
        System.out.println("今天中午吃的"+food);
    }
}